home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: MiNT 1.10 biosfs select() patch
- Date: Sat, 19 Feb 94 1:46:32 CET
- From: Juergen Lock <nox@jelal.north.de>
- In-Reply-To: <199402172223.AA06552@techfac.TechFak.Uni-Bielefeld.DE>; from "Torsten Scherer" at Feb 17, 94 11:13 pm
- Message-Id: <9402190046.AA00186@jelal.north.de>
-
- Torsten Scherer writes:
-
- > Ok, forget what I was telling some hours ago. The chunks came from the vcon
- > daemon from Juergen Lock.
-
- yea because its select never woke up before timeout...
-
- > Without the vcons, it doesn't work at all!
-
- aah so they are at least useful for something. ;)
-
- > Looks like you can still read characters from /dev/console, but select
- > doesn't work any longer. When tracking this down, I found this:
- >
- > diff -u3 orig/biosfs.c ./biosfs.c
- > --- orig/biosfs.c Thu Feb 17 16:55:00 1994
- > +++ ./biosfs.c Thu Feb 17 23:04:10 1994
- > @@ -1542,7 +1542,7 @@
- > }
- > if (tty) {
- > /* avoid collisions with other processes */
- > - if (!tty->rsel)
- > + if (tty->rsel)
- > return 2; /* collision */
- > tty->rsel = p;
- > }
- > @@ -1553,7 +1553,7 @@
- > return 1;
- > }
- > if (tty) {
- > - if (!tty->wsel)
- > + if (tty->wsel)
- > return 2; /* collision */
- > tty->wsel = p;
- > }
-
- thats number one...
-
- 2.
- intr.spp: ++nox@jelal.north.de
- Check for auto-repeating keys so that Fselect() wakes up more
- quickly.
-
- this was the wrong patch, the right one came a few days later...
-
- Index: intr.spp
- @@ -60,9 +60,6 @@
- move.l _old_timer+8,-(sp) ; jump to GEMDOS time vector
- rts
-
- - XREF _kintr
- - XREF _keyrec
- -
- _mint_vbl:
- %ifndef ONLY030
- tst.w ($59e).w ; test longframe (AKP)
- @@ -76,11 +73,6 @@
- rts
-
- L_comeback:
- - move.w d0,-(sp) ; `repeated' keys don't generate
- - move.w _keyrec+8,d0 ; interrupts... check buffer and
- - cmp.w _keyrec+6,d0 ; set hi byte of kintr so that
- - sne _kintr ; select can wake up before you
- - move.w (sp)+,d0 ; release the key, etc.
- tst.w _proc_clock ; has time expired yet?
- beq.s L_expired ; yes -- maybe go switch processes
- L_out:
- Index: timeout.c
- @@ -140,6 +140,10 @@
- * suspends the current process
- */
-
- +/* variables for monitoring the keyboard */
- +extern IOREC_T *keyrec; /* keyboard i/o record pointer */
- +extern short kintr; /* keyboard interrupt pending (see intr.s) */
- +
- volatile int our_clock = 1000;
-
- void ARGS_ON_STACK
- @@ -147,6 +151,8 @@
- {
- int ms; /* time between ticks */
-
- + *(char *)&kintr = (keyrec->head != keyrec->tail) ? -1 : 0;
- +
- ms = *((short *)0x442L);
- if (proc_clock > 0)
- proc_clock--;
-
- 3. (another select patch, not fatal)
-
- Index: fasttext.c
- @@ -1379,8 +1379,9 @@
- }
- if (tty) {
- /* avoid collisions with other processes */
- - if (!tty->rsel)
- - tty->rsel = p;
- + if (tty->rsel)
- + return 2;
- + tty->rsel = p;
- }
- return 0;
- } else if (mode == O_WRONLY) {
-
- 4.
- debug.c: ++nox@jelal.north.de
- Make only ctrl-alt-key characters significant to the
- debug code (before, any character could start/stop output).
-
- without this non-ctrl-alt keys were still eaten:
-
- Index: debug.c
- @@ -271,6 +271,7 @@
- do_func_key(scan);
- goto ptoggle;
- }
- + else goto cont;
- }
- else {
- key = Bconin(out_device);
- @@ -288,6 +289,7 @@
- }
- }
- }
- +cont:
- s++;
- }
- }
-
- 5. entropys zeroed-tty-pgroup fix...
-
- Index: dosmem.c
- @@ -748,6 +748,7 @@
- }
- }
-
- +#if 0
- /* release the controlling terminal, if we're a process group leader */
- fp = curproc->handle[-1];
- if (fp && is_terminal(fp) && curproc->pgrp == curproc->pid) {
- @@ -755,6 +756,7 @@
- if (curproc->pgrp == tty->pgrp)
- tty->pgrp = 0;
- }
- +#endif
-
- /* close all files */
- for (i = MIN_HANDLE; i < MAX_OPEN; i++) {
-
- 6. and some older ones...
-
- diff -uw ../fasttext.c ./fasttext.c
- --- ./fasttext.c Thu Jun 24 20:36:16 1993
- +++ ./fasttext.c Sat Jun 26 02:09:56 1993
- @@ -1058,7 +1058,15 @@
- SCREEN *v;
- int c;
- {
- +#if 0
- gotoxy(v, c - ' ', escy1 - ' ');
- +#else
- + /* some (un*x) termcaps seem to always set the hi bit on
- + cm args (cm=\EY%+ %+ :) -> drop that unless the screen
- + is bigger. -nox
- + */
- + gotoxy(v, (c - ' ') & (v->maxx|0x7f), (escy1 - ' ') & (v->maxy|0x7f));
- +#endif
- state = normal_putch;
- }
-
- diff -uw ../intr.spp ./intr.spp
- --- ./intr.spp Sat Jun 26 01:08:18 1993
- +++ ./intr.spp Sat Jun 26 01:20:54 1993
- @@ -272,6 +272,10 @@
- move.l _sig_routine,a1 ; get handler
- jsr (a1) ; go do it
- movem.l (sp)+,d0-d2/a0-a2
- +; 68000 processor bug: rte right after movem can eat interrupts...
- +%ifndef ONLY030
- + nop
- +%endif
- rte
-
- ;
-
- including our neverending story... the 1.10 version of the select-xkey fix. :)
-
- Index: console.c
- @@ -8,6 +8,8 @@
-
- #include "mint.h"
-
- +extern char vt52xkey[];
- +
- /*
- * These routines are what Cconout, Cauxout, etc. ultimately call.
- * They take an integer argument which is the user's file handle,
- @@ -28,6 +30,14 @@
- }
- r = 1; /* default is to assume input waiting (e.g. TOS files)*/
- (void)(*f->dev->ioctl)(f, FIONREAD, &r);
- +
- + if (!r && is_terminal(f)) {
- + struct tty *tty = (struct tty *)f->devinfo;
- + int scan = tty->state & TS_ESC;
- +
- + if (scan && (tty->xkey ? tty->xkey[scan] : vt52xkey[scan]))
- + r = 1;
- + }
- return r;
- }
-
- Index: dosfile.c
- @@ -8,6 +8,8 @@
-
- #include "mint.h"
-
- +extern char vt52xkey[];
- +
- static long do_dup P_((int,int));
- static void unselectme P_((PROC *));
-
- @@ -928,6 +930,14 @@
- r = (*f->dev->ioctl)(f, cmd, (void *)arg);
- if (r == EINVFN && is_terminal(f)) {
- r = tty_ioctl(f, cmd, (void *)arg);
- + } else if (cmd == FIONREAD && !r && !(*(long *)arg) &&
- + is_terminal(f)) {
- + struct tty *tty = (struct tty *)f->devinfo;
- + int scan = tty->state & TS_ESC;
- +
- + if (scan && (tty->xkey ? tty->xkey[scan] :
- + vt52xkey[scan]))
- + *(long *)arg = 1;
- }
- return r;
- }
- @@ -1010,8 +1020,15 @@
-
- for (i = 0; i < MAX_OPEN; i++) {
- if (rfd & mask) {
- + struct tty *tty;
- + int scan;
- +
- f = p->handle[i];
- - if ((*f->dev->select)(f, (long)p, O_RDONLY) == 1) {
- + if ((*f->dev->select)(f, (long)p, O_RDONLY) == 1 ||
- + (is_terminal(f) &&
- + (scan = (tty=(struct tty *)f->devinfo)->state & TS_ESC) &&
- + (tty->xkey ? tty->xkey[scan] :
- + vt52xkey[scan]))) {
- count++;
- *rfdp |= mask;
- }
- Index: tty.c
- @@ -233,7 +233,7 @@
-
- /* for RAW mode, if there are no more characters then break */
- if ( (mode & (T_RAW|T_CBREAK)) &&
- - !((rdmode & ESCSEQ) && (tty->state & TS_ESC))) {
- + !(tty->state & TS_ESC)) {
- r = 1;
- (void)(*f->dev->ioctl)(f, FIONREAD, &r);
- if (r <= 0) break;
- @@ -375,7 +375,7 @@
- * 28-31 are shift+cursor up, down, right, and left
- */
-
- -static char vt52xkey[256] = {
- +char vt52xkey[256] = {
- '\033', 'P', 0, 0, 0, 0, 0, 0,
- '\033', 'Q', 0, 0, 0, 0, 0, 0,
- '\033', 'R', 0, 0, 0, 0, 0, 0,
- @@ -665,19 +665,15 @@
- /* we may be in the middle of an escape sequence */
- scan = (tty->state & TS_ESC);
- if (scan != 0) {
- - if (mode & ESCSEQ) {
- - tab = tty->xkey ? tty->xkey : vt52xkey;
- - r = (unsigned char) tab[scan++];
- - if (r) {
- - c = UNDEF;
- - if (tab[scan] == 0) scan = 0;
- - }
- - else
- - scan = 0;
- - tty->state = (tty->state & ~TS_ESC) | scan;
- + tab = tty->xkey ? tty->xkey : vt52xkey;
- + r = (unsigned char) tab[scan++];
- + if (r) {
- + c = UNDEF;
- + if (tab[scan] == 0) scan = 0;
- }
- else
- - tty->state &= ~TS_ESC;
- + scan = 0;
- + tty->state = (tty->state & ~TS_ESC) | scan;
- }
-
- while (c != UNDEF) {
-
- ok happy patching...
- Juergen
-
- PS: i got a few mysterious crashes and once even saw a `kfree: memory
- not allocated by kmalloc' panic... went something wrong with the nalloc
- fixes? because my patched 1.09 never did that since...
-
- util.c: ++schwab@ls5.informatik.uni-dortmund.de
- In kmalloc(), the size passed to nalloc_add_arena() was wrong.
-
- nalloc2.c: ++nox@jelal.north.de
- Fixed the code for figuring out when to free an arena (it didn't
- use to take account of the arena size itself).
-
- PPS: yuo may get a few offsets, they are ok.
- --
- J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
- ...ohne Gewehr
- PGP public key fingerprint = 8A 18 58 54 03 7B FC 12 1F 8B 63 C7 19 27 CF DA
-